package com.zyr.controller;

import com.zyr.domain.Order;
import com.zyr.service.OrderService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 张雨润
 * @date 2024/7/28 下午8:03
 * @Description
 */
@RestController
@RequestMapping("/orders")
public class OrderController {
    @Resource
    private OrderService orderService;
    @GetMapping("/getOrders/{userId}")
    public List<Order> getListByUserId(@PathVariable("userId") long userId){
        return orderService.getListByUserId(userId);
    }
    @PostMapping("/add")
    public boolean add(@RequestBody Order order){
        return orderService.saveit(order);
    }
}
